<?php


namespace app\common\model;


use think\Model;

class Recharge extends Model
{
    /** 获取充值列表
     * @param array $where
     * @param $pageIndex
     * @param $pageSize
     * @return \think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public static function rechargeList(array $where,$pageIndex,$pageSize){
        return self::where($where)->order('id desc')->page($pageIndex,$pageSize)->select();
    }

    /*** 获取充值记录总条数
     * @param array $where
     * @return int
     */
    public static function rechargeCount(array $where){
        return intval(self::where($where)->count());
    }

    /** 充值记录增加
     * @param array $data
     * @return Recharge|Model
     */
    public static function rechargeAdd(array $data){
        return self::create($data);
    }
    
    
    /**
     * 充值记录查找
     * @param array $where
     */
    public static function rechargeQuery(array $where){
        return self::where($where)->find();
    }
    
    
    /***    充值修改 编辑
     * @param $where
     * @param $data
     * @return Activity
     */
    public static function rechargeEdit($where,$data){
        return self::update($data,$where);
    }
}